//
//  bohuiViewController.swift
//  BusinessIOS
//
//  Created by Rain on 2019/1/26.
//  Copyright © 2019 XingJian Li. All rights reserved.
//

import UIKit
import Alamofire
class bohuiViewController: UIViewController {
    var luruButton:UIButton!
    
    var xiangmuString:String!
    
    
    var informationRecordId:String!
    
    var taskId:String!
    
    var nameLabel:UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.view.backgroundColor = UIColor.white
        
        navigationItem.title="驳回"

        self.nameLabel = UILabel.init(frame: CGRect(x: 10, y: 70, width: self.view.frame.size.width - 10, height: 44))
        
        
        self.view .addSubview(self.nameLabel);
        
        
        let titleLabel = UILabel.init(frame: CGRect(x: 10, y: 100, width: 80 , height: 44))
        
        titleLabel.text = "驳回意见:"
        
        
        self.view .addSubview(titleLabel);
        
        
        
        let textView = UITextView(frame:CGRect(x:90,y:120,width:self.view.frame.size.width - 100,height:100));
        //设置边框粗细
        textView.layer.borderWidth = 1;
        //边框颜色
        textView.layer.borderColor = UIColor.gray.cgColor;
        self.view .addSubview(textView);
        
        
        
        
        self.luruButton = UIButton()
        //背景颜色
        self.luruButton.frame = CGRect(x: 10, y: self.view.frame.size.height - 49 - 40 , width: self.view.frame.size.width - 20, height: 40)
        self.luruButton.backgroundColor = UIColor.blue
        self.luruButton.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        self.luruButton.setTitle("确认", for: .normal )
        
        
        self.luruButton.addTarget(self,action:#selector(querenButtonClick), for: .touchUpInside)
        self.view.addSubview(self.luruButton)
        
        
        
        self.loadDate()

        
        
    }
    func loadDate()  {
        
        let urlString = "http://wwwqjzsyzcscom.aykj.net.cn/api/activiti/task/canReturnTask"
        
        let json = "{\"informationRecordId\":\"\(self.informationRecordId!)\",\"taskId\":\"\(self.taskId!)\"}"
        
        //             let json = "{\"account\":\"\(phoneTextField.text!)\",\"password\":\"\(PasswordTextField.text!)\",\"validateCode\":\"\(verificationTextField.text!)\"}"
        print("json====\(json)")
        
        let url = URL(string: urlString)!
        let jsonData = json.data(using: .utf8, allowLossyConversion: false)!
        
        var request = URLRequest(url: url)
        request.httpMethod = HTTPMethod.post.rawValue
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.httpBody = jsonData
        
        Alamofire.request(request).responseJSON {(response) in
            
         
          
             print("!2221===\(response)")
            
          
            if response.result.isSuccess {
        
              let json = JSON(response.data!)
                
                 let array = json["resultData"].dictionary
                
                
                
               
                print("!111===\(json)")

            }else{
               
            }
            
        }
        
        
    }
    
   
    @objc func querenButtonClick() {
    
    }

}
